﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace EventReminder.Common
{
    [DataContract]
    public class EventData : IComparable<EventData>
    {
        [DataMember]
        public EventTypes Type;

        [DataMember]
        public int ID;

        [DataMember]
        public DateTime Date;

        [DataMember]
        public string Title;

        [DataMember]
        public string Description;

        [DataMember]
        public IEnumerable<string> Emails;

        [DataMember]
        public string Reminder;

        [DataMember]
        public bool FollowUp;

        [DataMember]
        public DateTime LastReminderSent;

        [DataMember]
        public DateTime NextReminderDue;

        //Added by Les to make work in the EventReminder.Server App

        [DataMember]
        public bool Send;

        [DataMember]
        public bool Archive;

        [DataMember]
        public int MessageOwner;

        //End Add

        public override string ToString()
        {
            return String.Format("{0}:{1} - {2}", Date.Hour, Date.Minute, Title);
        }

        // sorting
        public int CompareTo(EventData other)
        {
            int d = Date.CompareTo(other.Date);

            if (d != 0)
                return d;

            return Title.CompareTo(other.Title);
        }
    }
}
